# Validators take input values from the configuration file and copies them into a type object
# This allows for encapsulation of validation of various common parts of the config file

from __future__ import absolute_import
import forest.types as types

__all__ = ['Validator', 'ValidateFile', 'ValidatePath', 'ValidateString', 'ValidateList']

class Validator(object):
    def input_value(self, value, config):
        'Supposed to return value wrapper/validated/processed right'
        return value
        
    def output_value(self, value, config):
        return value

class File(Validator):
    def input_value(self, value, config):
        'Should return a valid File'
        
        if not value:
            return value
           
        if isinstance(value, types.File):
            return value
                
        return types.File(value, config)
        
        
class LocalPath(Validator):
    def input_value(self, value, config):
        'Should return a valid path string'
        
        if not value:
            return value
           
        return value
        
